home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: hkuxb.hku.hk!indigo6!cfwong
- From: cfwong@csd.hku.hk (Chingfung Wong)
- Subject: HELP: Template linking problem
- Message-ID: <Dp37nJ.Etx@hkuxb.hku.hk>
- Sender: usenet@hkuxb.hku.hk (USENET News System)
- Nntp-Posting-Host: indigo6.cs.hku.hk
- Organization: The University of Hong Kong
- X-Newsreader: TIN [version 1.1 PL8]
- Date: Sat, 30 Mar 1996 15:42:55 GMT
-
- Hi
-
- I have templates list, stack, heap in list.h, stack.h, and heap.h
- respectively. Files A.cc and B.cc uses these templates. It is fine
- when I compile A.o and B.o, but problem arise when I issue
- "g++ -o program program.c A.o B.o"
-
- A.o(.text+0x1ed4): multiple defined reference to `SimpleList<Surface *>::N(void)'
- ....
- ..
-
- I understand the template classes are instantiated in both A.o and B.o
- and caused the comfusion, but don't know how to handle it.
-
- Would you help?
-
- Thanks!
-
- chingfung
-
-